//
// Unihan Input Method
//
// Copyright © 2002-2007 Sun Wah Linux Ltd.
//
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
// USA
//
// $Id: preprocess.c 757 2007-05-10 08:19:31Z roger $
//

/* FILE : preprocess.c */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <SWTable.h>
#include <unihan_im.h>

#include <stdio.h>

#include "im_config.h"
#include "candidates.h"
#include "preprocess.h"

InputList *
pp_get_input_list(BaseTable *base_table,
			Node *node,
			TableConfig *config,
			IMKeyEvent *kev)
{
#if DEBUG
	fprintf(stderr, "table : preprocess get input list\n");
#endif
	InputList *input_list = NULL;
	char **list = NULL;
	
	input_list = (InputList *)malloc(sizeof(InputList));
	memset(input_list, 0, sizeof(InputList));

	//FIXME : illegibility and shuangpin

	list = (char **)malloc(sizeof(char *) * 1);
	list[0] = (char *)malloc(sizeof(char) + 1);
	list[0][0] = kev->keyChar;
	list[0][1] = 0x0;
	input_list->num = 1;
	input_list->stringList = list;
	return input_list;
}

void
pp_purge_input_list(InputList *input_list)
{
	int i;

	for (i=0; i<input_list->num; i++) {
		free(input_list->stringList[i]);
	}
	free(input_list->stringList);
	input_list->num = 0;
}


// vi:ts=4:nowrap:cin:expandtab
